package com.smedi.ismedi.inmail.core.port.adapter.persistence.repository.impl;

import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.smedi.ismedi.inmail.core.domain.aggregatemodel.apppush.AppPushRecord;
import com.smedi.ismedi.inmail.core.domain.repository.AppPushRecordRepository;
import com.smedi.ismedi.inmail.core.port.adapter.persistence.model.AppPushRecordEntity;
import com.smedi.ismedi.inmail.core.port.adapter.persistence.mybatis.mapper.AppPushRecordMapper;
import com.smedi.ismedi.web.starter.util.DozerUtil;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Repository;

@Repository
@AllArgsConstructor
public class AppPushRecordRepositoryImpl extends ServiceImpl<AppPushRecordMapper, AppPushRecordEntity> implements AppPushRecordRepository, IService<AppPushRecordEntity> {
    private final DozerUtil dozerUtil;
    @Override
    public AppPushRecord doInsert(AppPushRecord appPushRecord) {
        AppPushRecordEntity appPushRecordEntity = dozerUtil.convertor(appPushRecord, AppPushRecordEntity.class);

        this.getBaseMapper().insert(appPushRecordEntity);

        return this.dozerUtil.convertor(appPushRecordEntity, AppPushRecord.class);
    }
}
